package cn.tedu.api;

import java.util.Scanner;

//测试 String工具类
public class Test2_String {
    public static void main(String[] args) {
        char[]c = {'h','e','l','l','o'};
        String s = new String(c);
        String s1 = "h e l l o";
        System.out.println(s1.contains("he"));
        System.out.println(s1.endsWith("ed"));
        System.out.println(s1.equals("hello"));
        System.out.println(s1.getBytes());
        System.out.println(s1.hashCode());
        System.out.println(s1.indexOf(" "));
        System.out.println(s1.isEmpty());
        System.out.println(s1.length());
        System.out.println(s1.replace(' ','m' ));
        System.out.println(s1.split("e"));
        System.out.println(s1.startsWith("h"));
        System.out.println(s1.substring(2));
        System.out.println(s1.substring(2,6));
        System.out.println(s1.toCharArray());
        System.out.println(s1.toLowerCase());
        System.out.println(s1.toUpperCase());
        System.out.println(s1.trim());
        String num = s1.valueOf(45);//把其他类型转成String类型
        System.out.println(num+1);
//TODO 接收用户输入的一组数据，并把每个数据打印出来
        String str = new Scanner(System.in).nextLine();
        for (int i = 0; i <str.length() ; i++) {
            char data = str.charAt(i);
            System.out.println(data);
        }



    }
}
